package com.audi.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.annotation.SuppressLint;

public class DateUtil {
	// Convert String to Date
	@SuppressLint("SimpleDateFormat")
	public static Date convertStringToDate(String format,
			String formatStringDate) {
		SimpleDateFormat msimpleDateFormat = new SimpleDateFormat(
				formatStringDate);
		try {
			return msimpleDateFormat.parse(format);
		} catch (ParseException e) {
			return null;
		}
	}

	// Convert Date to String

	@SuppressLint("SimpleDateFormat")
	public static String convertDateToString(Date dateCreated,
			String formatStringDate) {
		String msimpleDateFormat = new SimpleDateFormat(formatStringDate)
				.format(dateCreated);
		try {
			return msimpleDateFormat;
		} catch (Exception e) {
			return null;
		}

	}
}
